﻿<%@ Page Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="true" CodeBehind="SearchResult.aspx.cs"
    Inherits="Cucre.WebForm13" Title="MUARE.VN - Kết quả tìm kiếm sản phẩm" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<%@ Import Namespace="DTO" %>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="DAO" %>
<%@ Import Namespace="BUS" %>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <div style="padding-left: 6px;">
        <div class="clear">
        </div>
        <div class="br">
        </div>
        <div class="content_home">
            <div class="ch_1 font">
                <div class="l">
                    <div class="ll">
                    </div>
                    <div class="lc">
                        <ul id="tab_menu">
                            <li id="tabmnu_1"><a href="index.aspx"><span class="tab_mnu_l_curent"></span><span
                                class="tab_mnu_c_curent">CỰC RẺ HÔM NAY&nbsp; </span><span class="tab_mnu_r_curent">
                                </span></a></li>
                            <li id="tabmnu_4"><a href="danggiamgia.aspx"><span class="tab_mnu_l"></span><span
                                class="tab_mnu_c">ĐANG GIẢM GIÁ&nbsp;(<%=BUS.ProductBUS.GetProductStillSale().Count.ToString() %>)</span>
                                <span class="tab_mnu_r"></span></a></li>
                            <li id="tabmnu_2"><a href="khuyenmaisaptoi.aspx"><span class="tab_mnu_l"></span><span
                                class="tab_mnu_c">KHUYẾN MẠI SẮP TỚI&nbsp;(<%=BUS.ProductBUS.GetProductSapKhuyenMai().Count.ToString() %>)</span><span
                                    class="tab_mnu_r"></span></a></li>
                            <li id="tabmnu_3"><a href="daketthuc.aspx"><span class="tab_mnu_l"></span><span class="tab_mnu_c">
                                ĐÃ KẾT THÚC&nbsp;(<%=BUS.ProductBUS.GetProductEnded().Count.ToString() %>)</span>
                                <span class="tab_mnu_r"></span><a href="#"><span class="tab_mnu_l"></span><span class="tab_mnu_c">
                                    SẮP TỚI&nbsp;(1)</span></a></li>
                        </ul>
                    </div>
                    <div class="lr">
                    </div>
                </div>
                <div class="r">
                </div>
                <div class="clear">
                </div>
            </div>
            <div class="ch_2">
                <div style="padding: 1px; padding-left: 4px; padding-top: 10px;">
                    <%
                        List<PRODUCT> listProduct = new List<PRODUCT>();
                        string keyword = Request["keyword"];
                        listProduct = BUS.ProductBUS.Search(keyword);
                        if (listProduct == null)
                        {
                    %>
                    <div align="center">
                        <asp:Label runat="server">Không có sản phẩm nào</asp:Label>
                    </div>
                    <%
                        }
                        else
                        {
                            for (int i = 0; i < listProduct.Count; i++)
                            {
                                string timeStart = String.Format("{0:dd/MM/yy}", listProduct[i].TIME_START.Value);
                                string timeStop = String.Format("{0:dd/MM/yy}", listProduct[i].TIME_STOP.Value);
                                HyperLink1.NavigateUrl = "chitietsanpham.aspx?IDSanPham=" + listProduct[i].IDPRODUCT.ToString();
                                string slogan = listProduct[i].Name_Product;
                                double giaGoc = Math.Round((double)(listProduct[i].PRICE * 100 / (100 - listProduct[i].RATE_DECREASE)), 0);
                                string giaThuc = String.Format("{0:0,0}", giaGoc);
                                string phanTramGiam = listProduct[i].RATE_DECREASE.ToString();
                                string conLai = String.Format("{0:0,0}", listProduct[i].PRICE);
                                string soNguoiMua = listProduct[i].PurchasedNumber.ToString();
                                Image2.ImageUrl = "~/" + listProduct[i].IMAGE + "2.jpg";
                    %>
                    <div class="type_info" style="margin-right: 15px;">
                        <div class="frame">
                            <div>
                                <span class="date">
                                    <%=timeStart%>
                                    -
                                    <%=timeStop%></span>
                                <asp:HyperLink ID="HyperLink1" runat="server" CssClass="detail">Xem chi tiết</asp:HyperLink>
                            </div>
                            <div class="clear">
                            </div>
                            <div class="info_1">
                                <a href="#" class="title" title=" 25,000đ để MUA PHIẾU GIẢM 55% trên tổng hóa đơn khi mua sản phẩm thời trang thể thao Sakura Sport - Q.Tân Bình">
                                    <font style="font-size: large">
                                        <%=slogan%></font> </a>
                                <div class="clear">
                                </div>
                                <div class="info_2">
                                    <div class="table-1">
                                        Giá:
                                        <%=giaThuc%>
                                        VNĐ
                                        <br />
                                        Giảm
                                        <%=phanTramGiam%>%
                                        <br />
                                        Chỉ còn:
                                        <%=conLai%>
                                        VNĐ
                                        <br />
                                    </div>
                                    <div class="table-3">
                                        <%=soNguoiMua%>
                                        Người mua
                                    </div>
                                    <div style="margin-top: 5px" class="hethan_small">
                                    </div>
                                </div>
                                <div class="info_3">
                                    <a href="#" title=" 25,000đ để MUA PHIẾU GIẢM 55% trên tổng hóa đơn khi mua sản phẩm thời trang thể thao Sakura Sport - Q.Tân Bình">
                                        <asp:Image ID="Image2" runat="server" Width="200" Height="133" BorderWidth="0" /></a>
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                        </div>
                    </div>
                    <%
                        i++;
                        if (i < listProduct.Count)
                        {
                            timeStart = String.Format("{0:dd/MM/yy}", listProduct[i].TIME_START.Value);
                            timeStop = String.Format("{0:dd/MM/yy}", listProduct[i].TIME_STOP.Value);
                            HyperLink2.NavigateUrl = "chitietsanpham.aspx?IDSanPham=" + listProduct[i].IDPRODUCT.ToString();
                            slogan = listProduct[i].Name_Product;
                            giaGoc = Math.Round((double)(listProduct[i].PRICE * 100 / (100 - listProduct[i].RATE_DECREASE)), 0);
                            giaThuc = String.Format("{0:0,0}", giaGoc);
                            phanTramGiam = listProduct[i].RATE_DECREASE.ToString();
                            conLai = String.Format("{0:0,0}", listProduct[i].PRICE);
                            soNguoiMua = listProduct[i].PurchasedNumber.ToString();
                            Image1.ImageUrl = "~/" + listProduct[i].IMAGE + "2.jpg";
                    %>
                    <div class="type_info">
                        <div class="frame">
                            <div>
                                <span class="date">
                                    <%=timeStart%>
                                    -
                                    <%=timeStop%></span>
                                <asp:HyperLink ID="HyperLink2" runat="server" CssClass="detail">Xem chi tiết</asp:HyperLink>
                            </div>
                            <div class="clear">
                            </div>
                            <div class="info_1">
                                <a href="#" class="title" title=" 25,000đ để MUA PHIẾU GIẢM 55% trên tổng hóa đơn khi mua sản phẩm thời trang thể thao Sakura Sport - Q.Tân Bình">
                                    <font style="font-size: large">
                                        <%=slogan%></font> </a>
                                <div class="clear">
                                </div>
                                <div class="info_2">
                                    <div class="table-1">
                                        Giá:
                                        <%=giaThuc%>
                                        VNĐ
                                        <br />
                                        Giảm
                                        <%=phanTramGiam%>%
                                        <br />
                                        Chỉ còn:
                                        <%=conLai%>
                                        VNĐ
                                        <br />
                                    </div>
                                    <div class="table-3">
                                        <%=soNguoiMua%>
                                        Người mua
                                    </div>
                                    <div style="margin-top: 5px" class="hethan_small">
                                    </div>
                                </div>
                                <div class="info_3">
                                    <a href="#" title="">
                                        <asp:Image ID="Image1" runat="server" Width="200" Height="133" BorderWidth="0" /></a>
                                </div>
                                <div class="clear">
                                </div>
                            </div>
                        </div>
                    </div>
                    <%
                        }
                    %>
                    <%
                        }
                        } %>
                    <div class="br">
                    </div>
                    <div class="br">
                    </div>
                    <div class="clear">
                    </div>
                    <div class="br">
                    </div>
                </div>
            </div>
            <div class="clear">
            </div>
            <div class="ch_3">
                <div class="ch_4">
                    &nbsp;</div>
            </div>
            <div class="clear">
            </div>
        </div>
    </div>
</asp:Content>
